<#assign menuId=4>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>填写生产日期-${Application.systemName!}</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <!-- bootstrap 3.0.2 -->
    <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <!-- font Awesome -->
    <link href="../css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <!-- Ionicons -->
    <link href="../css/ionicons.min.css" rel="stylesheet" type="text/css" />
    <!-- Theme style -->
    <link href="../css/AdminLTE.css" rel="stylesheet" type="text/css" />
	<!--datetimepicker-->
	<link rel="stylesheet" type="text/css" href="../css/datetimepicker/bootstrap-datetimepicker.min.css"/>
	<link rel="stylesheet" type="text/css" href="../css/bootstrapValidator.min.css"/>
	<link rel="stylesheet" type="text/css" href="../css/myself.css"/>
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
    <style type="text/css">
        *{
            margin: 0;
            padding: 0;
        }
        ul li{
            list-style: none;
            margin-top: 10px;
        }
        .table>thead>tr>th, .table>tbody>tr>th, .table>tfoot>tr>th, .table>thead>tr>td, .table>tbody>tr>td, .table>tfoot>tr>td {
		    vertical-align: middle;
		}
        .pull-left{
            border-left: 6px solid #3882FF;
            padding: 0 5px;
            font-size: 14px;
            margin-bottom: 10px;
        }
     	.table tr td:nth-child(1) {
     		text-align: center;
     	}
        small.help-block{
        	color:red;
        }
    </style>
</head>
<body class="skin-blue">
<!-- header logo: style can be found in header.less -->
<#include "../header.html"/>
<div class="wrapper row-offcanvas row-offcanvas-left">
    <!-- Left side column. contains the logo and sidebar -->
    <#include "../menu.html"/>

    <!-- Right side column. Contains the navbar and content of the page -->
    <aside class="right-side">
        <section class="content-header">
            <h1 >填写生产日期
            </h1>
          

        </section>
        <!-- Content Header (Page header) -->
        <section class="content">
            <div class="row">
                <div class="col-md-12">
                    <div class="box"  style="padding: 20px;">
                        <div class="clearfix center" style="margin-top: 10px;">
                            <span class="pull-left four-font">填写基本信息</span>
                        </div>
                        <div class="center">
                        <form id="form">
                            <table class="table table-bordered custormView">
                                <tr>
                                    <td width="7%" align="right">面料到期日</td>
                                    <td width="93%">
										<div class="input-group date form_datetime col-md-5">
											<input class="form-control" type="text"
												name="materialExpire" value="<#if productionPattern.materialExpire??>${productionPattern.materialExpire?string("yyyy-MM-dd HH:mm")}</#if>"> <span
												class="input-group-addon"><span
												class="glyphicon glyphicon-th"></span></span>
										</div>
									</td>
                                </tr>
                                <tr>
                                <td align="right">生产起始日 </td>
                                    <td>
                                    <div 
								class="input-group date form_datetime col-md-5">
								<input class="form-control" type="text"
									name="produceStartdate" value="<#if productionPattern.produceStartdate??>${productionPattern.produceStartdate?string("yyyy-MM-dd HH:mm")}</#if>"> <span
									class="input-group-addon"><span
									class="glyphicon glyphicon-th"></span></span>
							</div>
							<p></p>
							<div 
								class="input-group">是否有首件样 
								<#if productionPattern.firstSample??>
								<input type="radio" name="isfirstSampleChk" value="1"  checked="checked" id="chkradio1"/>有
									<input name="isfirstSampleChk"  type="radio" value="2"  id="chkradio2"/>无</div>
							
								<#else>
								<input type="radio" name="isfirstSampleChk"  value="1"  id="chkradio1"/>有
								<input name="isfirstSampleChk"  type="radio" value="2" id="chkradio2" checked="checked" />无</div>
								</#if>
							</td>
                                </tr>
                                <#if productionPattern.firstSample??>
                                <tr id="isfirstSample"><td>检查首件样时间</td>
                                    <td>
										<div 
								class="input-group date form_datetime col-md-5">
								<input class="form-control" type="text"
									name="firstSample" value="${productionPattern.firstSample?string("yyyy-MM-dd HH:mm")}"> <span
									class="input-group-addon"><span
									class="glyphicon glyphicon-th"></span></span>
							</div>
							<p></p>
							<div class="form-group textarea">
                                            <textarea class="form-control" name="firstSampleMemo" rows="2" >${productionPattern.firstSampleMemo!}</textarea>
                                        </div>
                                        
                                    </td>
                                </tr>
                                <#else>
                                <tr style="display:none" id="isfirstSample"><td>检查首件样时间</td>
                                    <td>
										<div 
								class="input-group date form_datetime col-md-5">
								<input class="form-control" type="text"
									name="firstSample" value=""> <span
									class="input-group-addon"><span
									class="glyphicon glyphicon-th"></span></span>
							</div>
							<p></p>
							<div class="form-group textarea">
                                            <textarea class="form-control" name="firstSampleMemo" rows="2" ></textarea>
                                        </div>
                                        
                                    </td>
                                </tr>
                                </#if>
                                
                                <tr>
                                <td align="right">生产完成日 </td>
                                    <td>
                                    <div 
								class="input-group date form_datetime col-md-5">
								<input class="form-control" type="text"
									name="produceEnddate" value="<#if productionPattern.produceEnddate??>${productionPattern.produceEnddate?string("yyyy-MM-dd HH:mm")}</#if>"> <span
									class="input-group-addon"><span
									class="glyphicon glyphicon-th"></span></span>
							</div>
							</td>
							
                                </tr>
                               
                              
                            </table>
                           </form>
                           

                            <p>
                                <button type="button" class="btn btn-primary" onclick="saveProduceDate()" style="margin-right: 10px;">保存</button>
                               
                                <button type="button" class="btn btn-default" onclick="window.location.href='../productionorder/list'">取消</button>
                            </p>
                        </div>
                    </div><!-- /.box -->


                </div><!-- /.col -->

            </div><!-- /.row -->

        </section>

        <!-- Main content -->
        <section class="content">


        </section><!-- /.content -->


    </aside><!-- /.right-side -->
</div><!-- ./wrapper -->

<!-- jQuery 2.0.2 -->
<script src="../js/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="../js/bootstrap.min.js" type="text/javascript"></script>
<!-- AdminLTE App -->
<script src="../js/AdminLTE/app.js" type="text/javascript"></script>
<script src="../js/jquery.form.min.js"></script>
<!--datepickes-->
<script src="../js/plugins/datetimerpicker/bootstrap-datetimepicker.min.js" type="text/javascript"></script>
	
		<script src="../js/plugins/datetimerpicker/locales/bootstrap-datetimepicker.zh-CN.js" type="text/javascript"></script>
        <script src="../js/bootstrapValidator.min.js" type="text/javascript"></script>
</body>
<script type="text/javascript">


$(function() {
    $('.form_datetime').datetimepicker({
    	format: 'yyyy-mm-dd hh:00',
       	language:  'zh-CN',  
        weekStart: 1,  
        todayBtn:  1,  
        autoclose: 1,  
        todayHighlight: 1,  
        startView: 2,  
        forceParse: 0,  
        showMeridian: 0,
        minView: 1,
        startDate: new Date()
    });
  
   
});
function saveProduceDate(){
	$('#form').data('bootstrapValidator').validate();  
    if(!$('#form').data('bootstrapValidator').isValid()) return false;
	$("#form").ajaxSubmit({
	    type: "POST",
	    dataType: "json",
	    url: "saveProduceDate",
	    data:{id:${productionPatternId}},
	    
	    success : function(map) {  
	    	if(map.head.respCode=="0000000"){
	    		success("保存成功",function(){
	        		window.location.href='../productionorder/list';
	        	});
	        }else{
	        	alert(map.body);
	        }
	    },  
	    error : function(map) {  
	        alert("出现错误，请刷新页面");  
	    }  

	});
}

$("#chkradio1").on('ifChecked', function(event) {
    //Uncheck all checkboxes
    $("#isfirstSample").show();
});
$("#chkradio2").on('ifChecked', function(event) {
    //Uncheck all checkboxes
	$("#isfirstSample").hide();
});

function checkForm(){
	$('#form').bootstrapValidator({
		  fields: {
			  materialExpire: {
		    	  trigger:'blur change',
		          validators: {
		              regexp: {
	                        regexp: /^\w{4}-\w{2}-\w{2} \w{1,2}:\w{2}$/,
	                        message: '面料到期日不符'
	                  }
		          }
		      },
		      produceStartdate: {
		    	  trigger:'blur change',
		    	  validators: {
		    		  regexp: {
	                        regexp: /^\w{4}-\w{2}-\w{2} \w{1,2}:\w{2}$/,
	                        message: '生产起始日不符'
	                  }
		          }
		      },
		      firstSample: {
		    	  trigger:'blur change',
		    	  validators: {
		    		  regexp: {
	                        regexp: /^\w{4}-\w{2}-\w{2} \w{1,2}:\w{2}$/,
	                        message: '检查首件样时间不符'
	                  }
		          }
		      },
		      produceEnddate:{
		    	  trigger:'blur change',
		    	  validators: {
		              regexp: {
	                        regexp: /^\w{4}-\w{2}-\w{2} \w{1,2}:\w{2}$/,
	                        message: '生产完成日不符'
	                  }
		          }
		      }
		  }
	});
}

$(function(){
	checkForm();
})
</script>
</html>
